export async function getTableData(root, callback) {
  // root.loading = true
  const { data: res } = await callback
  root.tableData = res.records
  root.total = res.total
  root.loading = false
}

export async function handleVoidMethod(root, success, error, callback, other) {
  const data = await callback
  if (data.code === 200) {
    root.$message({ type: 'success', message: success })
    other && other()
    root.getTableData()
  } else {
    root.$message({ type: 'error', message: error })
  }
}
